#ifndef __HUMBLE_GL_CONTEXT_H__ 
#define  __HUMBLE_GL_CONTEXT_H__
#include "Core/humble_context.h"

// System Headers.
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <GL/gl.h>
#include <GL/glx.h>

// create the define for glXCreateContextAttribsARBProc
#ifndef glXCreateContextAttribsARBProc
#define GLX_CONTEXT_MAJOR_VERSION_ARB       0x2091
#define GLX_CONTEXT_MINOR_VERSION_ARB       0x2092
typedef GLXContext (*glXCreateContextAttribsARBProc)(Display*, GLXFBConfig, GLXContext, Bool, const int*);
#endif

class GLX_Video_Context : public  Humble_Video_Context
{
    public:
        GLX_Video_Context();
        ~GLX_Video_Context();
        bool initialize();
        bool CreateWindow();
        bool DestroyWindow();
        bool setResolution(int height, int width);
        bool setFullScreen(bool fullscreen);
        bool isFullscreen()=0;
        void setWindowName(size_t s_name, char *name);
        void flipPages();
        int ErrorHandler( Display *dpy, XErrorEvent *ev );
    private:
        void setWindowGroup(size_t s_name, char *name);
        Display *m_hdisplay;
        Window   m_hwindow;
        Colormap m_hcmap;
        GLXFBConfig bestFbc;
        char *glxExts;
        GLXContext m_GLX_Context;
        bool m_ErrorOccurred;
		bool m_IsGL30Context;
        int *visual_attribs;
        glXCreateContextAttribsARBProc glXCreateContextAttribsARB;
};

#endif

